package com.yyh1;

import sun.dc.pr.PRError;

public class Book {
    //属性
    //书名
    private String bookname;
    //作者
    private String author;
    //出版社名
    private String liboaryname;
    //价格
    private double price;

    public Book() {
    }

    public Book(String bookname, String author, String liboaryname, double price) {
        this.bookname = bookname;
        this.author = author;
        this.liboaryname = liboaryname;
        setPrice(price);
    }

    public String getBookname() {
        return bookname;
    }

    public void setBookname(String bookname) {
        this.bookname = bookname;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getLiboaryname() {
        return liboaryname;
    }

    public void setLiboaryname(String liboaryname) {
        this.liboaryname = liboaryname;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        if (price<10){
            System.out.println("价格错误");
        }else {
            this.price = price;
        }

    }

    //行为
    //信息介绍
    public void show(){
        System.out.println("书名："+bookname+"\n"+"作者："+author+"\n"+"出版社："+liboaryname+"\n"+"价格："+price+"元");
    }
}
